<?
require_once("../config/dbconn.php");require_once("../config/powercls.php");

//获取会员信息
$sqlhy="select * from {$db_prefix}users where id='$id'";
$rshy=$db->get_one($sqlhy);
$regpv=0;//报单业绩
$regnum=0;
$regmoney=0;//报单金额

$glornamejj="glo_regprice_".$rank0;
$regmoney=$$glornamejj;
$glornamepv="glo_regpv_".$rank0;
$regpv=$$glornamepv; 
$glornamepv="glo_regnum_".$rank0;
$regnum=$$glornamepv; 
$glornamerate="glo_lcrate_".$rank0;
$gpprice=$$glornamerate;//报单单数
if($rshy["price"]<$regmoney)
{
	echo "<script>alert('报单币不足，不能进行复投');location.href='futou_lst.php?pageno={$pageno}';</script>";exit();
}
if($rshy["ft_backnumber"]==$rshy["ft_number"]&&$rshy["autotx"]==1){
if ($act=='add'){
	//插入到数据库
	unset($dataArray);
	//固定红利		
	$dataArray['ft_times']=trim($ft_times);
	$dataArray['ft_backnumber']=0;
	$dataArray['ft_startdate']=$curtime;;
	if($times==1)	
	{	
		$dataArray['ft_enddate']=$curtime+3600*24*150;
		$dataArray['ft_number']=15;
	}
	else 
	{	$dataArray['ft_enddate']=$curtime+3600*24*trim($times)*100;
		$dataArray['ft_number']=trim($times)*10;
	}
	$dataArray['ft_thisdate']=$curtime;
	$dataArray['ft_nextdate']=$curtime+3600*24*10;
	$dataArray['ft_summoney']=0;
	$dataArray['ft_realmoney']=0;
	$dataArray['autotx']=0;
	$db->update("{$db_prefix}users",$dataArray,"id='$id'");

	//更新成功
	
	echo "<script>alert('复投成功');location.href='futou_lst.php?pageno={$pageno}';</script>";exit();
	}
}
else
{
	echo "<script>alert('上轮投资没有结束，不能进行复投');location.href='futou_lst.php?pageno={$pageno}';</script>";exit();
}

?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	
}
.red{
	color:red
}
td{
	font-size:12px;
}
-->
</style>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/utils.js"></script>
<script type="text/javascript" src="js/user_edit.js"></script>
<link href="images/skin.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="17" height="29" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td>
    <td width="935" height="29" valign="top" background="images/content-bg.gif"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
      <tr>
        <td height="31"><div class="titlebt">固定红利——复投</div></td>
      </tr>
    </table></td>
    <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td>
  </tr>
  <tr>
    <td height="71" valign="middle" background="images/mail_leftbg.gif">&nbsp;</td>
    <td valign="top" bgcolor="#F7F8F9"><table width="100%" height="138" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="13" valign="top">&nbsp;</td>
      </tr>
      <tr>
        <td valign="top">
		<form id="form1" name="form1" method="post" action="?act=add" onSubmit="return usereditdo(this);">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td colspan="3"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="nowtable">
                <tr>
                  <td class="left_bt2">&nbsp;&nbsp;&nbsp;&nbsp;</td>
                </tr>
              </table></td>
            </tr>
            <tr>
              <td height="30" colspan="3">
			  
			  <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td width="17%" height="30" align="center" bgcolor="#f2f2f2" class="left_txt">会员编号</td>
                  <td width="83%" height="30" bgcolor="#f2f2f2" class="left_txt"><?=$rshy['username']?></td>
                </tr>
                <tr>
                  <td height="30" align="center" class="left_txt">姓名</td>
                  <td height="30" class="left_txt"><?=$rshy['nickname']?></td>
                </tr>                
				   
                   <td height="30" align="center" bgcolor="#f2f2f2" class="left_txt">已投资次次数</td>
                  <td height="30" bgcolor="#f2f2f2" class="left_txt"><?=$rshy['ft_times']?>	 </td>
                     </tr>
                  <tr>
                  <td height="30" align="center" bgcolor="#f2f2f2" class="left_txt">下次投资次数</td>
                  <td height="30" bgcolor="#f2f2f2" class="left_txt"><label>
                    <input name="ft_times" id="ft_times" value="<?=$rshy['ft_times']+1?>">					
                  </label></td>
                </tr>
                <tr>
				     <td height="30" align="center" bgcolor="#f2f2f2" class="left_txt">复投级别</td>
				     <td height="30" bgcolor="#f2f2f2" class="left_txt">
                     <select name="rank0" id="rank0" onChange="rankchange(this.value)">
                       <?
				  foreach($hyrankary as $k1=>$v1){
				 	 echo "<option value='{$k1}'";
				  	/*$glorname="glo_regprice_{$k1}";
					if ($allprice>=$$glorname){
						echo " selected";
					}*/
				  	echo ">{$v1}</option>";
				  }
				  ?>
                     </select>                  
				     </tr>
				    <tr>
                   <td height="30" align="center" bgcolor="#f2f2f2" class="left_txt">报单币余额</td>
                  <td height="30" bgcolor="#f2f2f2" class="left_txt"><?=$rshy['price']?>	 </td>
                     </tr>
            
            <tr>
              <td height="30" colspan="3" align="center"><label id="reg_notice" class="red"></label></td>
            </tr>
            <tr>
              <td width="50%" height="30" align="right"><span class="left_txt">
                <input name="pageno" type="hidden" id="pageno" value="<?=$pageno?>">
                <input type="hidden" name="id" id="id" value="<?=$id?>">
                </span>
                <input type="submit" value="完成以上修改" name="B1" /></td><td width="6%" height="30" align="right">&nbsp;</td>
                <td width="44%" height="30">&nbsp;</td>
            </tr>
            <tr>
              <td height="30" colspan="3">&nbsp;</td>
            </tr>
          </table>
		  </form>
		  </td>
      </tr>
    </table></td>
     </tr>
  
</table>

</body>
</html>